{"componentChunkName":"component---node-modules-rocketseat-gatsby-theme-docs-core-src-templates-docs-query-js","path":"/manual-review/UltraVault-UVT","result":{"data":{"mdx":{"id":"ed6ea989-20b8-5d2c-9e9c-44161298b4a2","excerpt":"UVT-01M: Insecure Integration of Parent Dependency Type Severity Location Logical Fault UltraVault.sol:L171-L173 Description: The  UltraVault::beforeDeposit…","fields":{"slug":"/manual-review/UltraVault-UVT/"},"frontmatter":{"title":"UltraVault Manual Review Findings","description":"Contains all the findings that relate to manual review on the contract codebase","image":null,"disableTableOfContents":null},"body":"var _excluded = [\"components\"];\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"UltraVault Manual Review Findings\",\n  \"description\": \"Contains all the findings that relate to manual review on the contract codebase\"\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, _excluded);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"h2\", {\n    \"id\": \"span-iduvt-01muvt-01m-insecure-integration-of-parent-dependencyspan\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#span-iduvt-01muvt-01m-insecure-integration-of-parent-dependencyspan\",\n    \"aria-label\": \"span iduvt 01muvt 01m insecure integration of parent dependencyspan permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), mdx(\"span\", {\n    id: \"UVT-01M\"\n  }, \"UVT-01M: Insecure Integration of Parent Dependency\")), mdx(\"table\", null, mdx(\"thead\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"thead\"\n  }, mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Type\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Severity\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Location\"))), mdx(\"tbody\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"a\", {\n    parentName: \"td\",\n    \"href\": \"/reports/ultra-yield-vault-contracts-68aaf30fb32fb20018fa5e24/appendix/finding-types#logical-fault\"\n  }, \"Logical Fault\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"img\", {\n    parentName: \"td\",\n    \"className\": \"o-severity o-medium\",\n    \"src\": \"https://omniscia.io/report-assets/medium.png\"\n  })), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"a\", {\n    parentName: \"td\",\n    \"href\": \"https://github.com/UltraYield/contracts/blob/b4cf59242df2566e10e0670040658f8d851cba1e/src/vaults/UltraVault.sol#L171-L173\"\n  }, \"UltraVault.sol:L171-L173\"))))), mdx(\"h3\", {\n    \"id\": \"description\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#description\",\n    \"aria-label\": \"description permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Description:\"), mdx(\"p\", null, \"The \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/UltraYield/contracts/blob/b4cf59242df2566e10e0670040658f8d851cba1e/src/vaults/UltraVault.sol#L171-L173\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"UltraVault::beforeDeposit\")), \" function is meant to integrate into the pre-deposit hook of the parent \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/UltraYield/contracts/blob/b4cf59242df2566e10e0670040658f8d851cba1e/src/vaults/BaseControlledAsyncRedeem.sol#L375-L404\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"BaseControlledAsyncRedeem::_performDeposit\")), \" function, however, in doing so it will cause all incoming deposits to be immediately diluted.\"), mdx(\"p\", null, \"Specifically, the \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/UltraYield/contracts/blob/b4cf59242df2566e10e0670040658f8d851cba1e/src/vaults/BaseControlledAsyncRedeem.sol#L375-L404\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"BaseControlledAsyncRedeem::_performDeposit\")), \" function is invoked with an \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"assets\"), \" and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"shares\"), \" pair reflecting the state of the vault \", mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"before the fees have been captured\"), \".\"), mdx(\"p\", null, \"As the fees result in an increase of the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"totalSupply\"), \" of the token, the actual share-to-asset ratio is mutated within the \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/UltraYield/contracts/blob/b4cf59242df2566e10e0670040658f8d851cba1e/src/vaults/UltraVault.sol#L171-L173\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"UltraVault::beforeDeposit\")), \" function even though the original \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/UltraYield/contracts/blob/b4cf59242df2566e10e0670040658f8d851cba1e/src/vaults/BaseControlledAsyncRedeem.sol#L375-L404\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"BaseControlledAsyncRedeem::_performDeposit\")), \" function would continue with the pre-fee share-to-asset ratio.\"), mdx(\"p\", null, \"This results in a consistent over-dilution of new depositors which is incorrect.\"), mdx(\"h3\", {\n    \"id\": \"impact\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#impact\",\n    \"aria-label\": \"impact permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Impact:\"), mdx(\"p\", null, \"All new depositors are unfairly diluted as they will receive less shares than their assets would normally entail, causing existing shareholders to receive the diluted deposit's proceeds.\"), mdx(\"h3\", {\n    \"id\": \"example\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#example\",\n    \"aria-label\": \"example permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Example:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-sol\",\n    \"metastring\": \"title=src/vaults/UltraVault.sol highlight={4} lineNumbers=true lineOffset=168\",\n    \"title\": \"src/vaults/UltraVault.sol\",\n    \"highlight\": \"{4}\",\n    \"lineNumbers\": \"true\",\n    \"lineOffset\": \"168\"\n  }, \"/// @notice Collect fees before deposit\\n/// @dev Expected to be overridden in inheriting contracts\\nfunction beforeDeposit(address, uint256, uint256) internal virtual override {\\n    _collectFees();\\n}\\n\")), mdx(\"h3\", {\n    \"id\": \"recommendation\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#recommendation\",\n    \"aria-label\": \"recommendation permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Recommendation:\"), mdx(\"p\", null, \"We advise fee collection to occur through overridden \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/UltraYield/contracts/blob/b4cf59242df2566e10e0670040658f8d851cba1e/src/vaults/BaseControlledAsyncRedeem.sol#L365-L372\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"BaseControlledAsyncRedeem::_mintWithAsset\")), \" and \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/UltraYield/contracts/blob/b4cf59242df2566e10e0670040658f8d851cba1e/src/vaults/BaseControlledAsyncRedeem.sol#L307-L315\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"BaseControlledAsyncRedeem::_depositAsset\")), \" functions, ensuring fees are captured prior to the preview functions and thus prior to the total supply measurements that deposit operations would rely on.\"), mdx(\"h3\", {\n    \"id\": \"alleviation-28f27853965de07fb79f4f2b5fed696d35120032\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#alleviation-28f27853965de07fb79f4f2b5fed696d35120032\",\n    \"aria-label\": \"alleviation 28f27853965de07fb79f4f2b5fed696d35120032 permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Alleviation (28f27853965de07fb79f4f2b5fed696d35120032):\"), mdx(\"p\", null, \"The code was updated per our recommendation, overriding the relevant \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"BaseControlledAsyncRedeem\"), \" functions to ensure that fees are imposed correctly and securely.\"), mdx(ViewDiffButton, {\n    repoUrl: \"https://github.com/UltraYield/contracts\",\n    mainHash: \"b4cf59242df2566e10e0670040658f8d851cba1e\",\n    fixHash: \"28f27853965de07fb79f4f2b5fed696d35120032\",\n    gitHubIssue: \"0\",\n    mdxType: \"ViewDiffButton\"\n  }));\n}\n;\nMDXContent.isMDXComponent = true;","headings":[{"depth":2,"value":"<span id=\"UVT-01M\">UVT-01M: Insecure Integration of Parent Dependency</span>"},{"depth":3,"value":"Description:"},{"depth":3,"value":"Impact:"},{"depth":3,"value":"Example:"},{"depth":3,"value":"Recommendation:"},{"depth":3,"value":"Alleviation (28f27853965de07fb79f4f2b5fed696d35120032):"}]}},"pageContext":{"slug":"/manual-review/UltraVault-UVT/","prev":{"label":"UltraFeeder.sol (UFR-M)","link":"/manual-review/UltraFeeder-UFR"},"next":{"label":"UltraVaultOracle.sol (UVO-M)","link":"/manual-review/UltraVaultOracle-UVO"}}},"staticQueryHashes":["1954253342","2328931024","2501019404","973074209"]}